home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / UTIL / SCREEN / CURSES01 / minix / c / options < prev    next >
Text File  |  1991-05-05  |  4KB  |  140 lines

  1. /****************************************************************/
  2. /* Idlok(), clearok(), leaveok(), scrollok(), nodelay(), key-    */
  3. /* pad(), meta(), cursoff() and curson() routines of the    */
  4. /* PCcurses package.                        */
  5. /*                                */
  6. /****************************************************************/
  7. /* This version of curses is based on ncurses, a curses version    */
  8. /* originally written by Pavel Curtis at Cornell University.    */
  9. /* I have made substantial changes to make it run on IBM PC's,    */
  10. /* and therefore consider myself free to make it public domain.    */
  11. /*        Bjorn Larsson (...mcvax!enea!infovax!bl)    */
  12. /****************************************************************/
  13. /* 1.0:    Release:                    870515    */
  14. /****************************************************************/
  15. /* Modified to run under the MINIX operating system by Don Cope */
  16. /* These changes are also released into the public domain.      */
  17. /*                             900906  */
  18. /****************************************************************/
  19.  
  20. #include <curses.h>
  21. #include "curspriv.h"
  22.  
  23. static bool    hasold = FALSE;        /* for remembering old cursor type */
  24. static int    oldmode;
  25.  
  26. /****************************************************************/
  27. /* Idlok() is used to set  flag for using the terminal insert/    */
  28. /* delete line capabilities. This is not relevant for the PC    */
  29. /* version of curses, and thus nothing is done.            */
  30. /****************************************************************/
  31.  
  32. void idlok(win, flag)
  33.   WINDOW    *win;
  34.   bool         flag;
  35.   {
  36.   } /* idlok */
  37.  
  38. /****************************************************************/
  39. /* Clearok() marks window 'win' to cause screen clearing and    */
  40. /* redraw the next time a refresh is done.            */
  41. /****************************************************************/
  42.  
  43. void clearok(win, flag)
  44.   WINDOW    *win;
  45.   bool         flag;
  46.   {
  47.   if (win == curscr)
  48.     _cursvar.tmpwin->_clear = flag;
  49.   else
  50.     win->_clear = flag;
  51.   } /* clearok */
  52.  
  53. /****************************************************************/
  54. /* Leaveok() marks window 'win' to allow the update routines    */
  55. /* to leave the hardware cursor where it happens to be at the    */
  56. /* end of update. Usually used in combination with cursoff().    */
  57. /****************************************************************/
  58.  
  59. void leaveok(win, flag)
  60.   WINDOW    *win;
  61.   bool         flag;
  62.   {
  63.   win->_leave = flag;
  64.   } /* leaveok */
  65.  
  66. /****************************************************************/
  67. /* Scrollok() marks window 'win' to allow the scrolling region    */
  68. /* of it to actually scroll.                    */
  69. /****************************************************************/
  70.  
  71. void scrollok(win, flag)
  72.   WINDOW    *win;
  73.   bool         flag;
  74.   {
  75.   win->_scroll = flag;
  76.   } /* scrollok */
  77.  
  78. /****************************************************************/
  79. /* Nodelay() marks the window to make character input non-    */
  80. /* waiting, i.e. if there is no character to get, -1 will be    */
  81. /* returned.                            */
  82. /****************************************************************/
  83.  
  84. void nodelay(win, flag)
  85.   WINDOW    *win;
  86.   bool         flag;
  87.   {
  88.   win->_nodelay = flag;
  89.   } /* nodelay */
  90.  
  91. /****************************************************************/
  92. /* Keypad() marks window 'win' to use the special keypad mode.    */
  93. /****************************************************************/
  94.  
  95. void keypad(win, flag)
  96.   WINDOW    *win;
  97.   bool         flag;
  98.   {
  99.   win->_keypad = flag;
  100.   } /* keypad */
  101.  
  102. /****************************************************************/
  103. /* Meta() allows use of any alternate character set allowed by    */
  104. /* the terminal. We always allow this on the PC, so this one    */
  105. /* does nothing.                        */
  106. /****************************************************************/
  107.  
  108. void meta(win, flag)
  109.   WINDOW    *win;
  110.   bool         flag;
  111.   {
  112.   } /* meta */
  113.  
  114. /****************************************************************/
  115. /* Cursoff() turns off the hardware cursor.            */
  116. /****************************************************************/
  117.  
  118. void cursoff()
  119.   {
  120.   if (!hasold)
  121.     {
  122.     oldmode = _cursesgcmode();        /* get old cursor type */
  123.     hasold = TRUE;
  124.     }
  125.   _cursescmode(FALSE);            /* turn it off */
  126.   } /* cursoff */
  127.  
  128. /****************************************************************/
  129. /* Curson() turns on the hardware cursor.            */
  130. /****************************************************************/
  131.  
  132. void curson()
  133.   {
  134.   if (hasold)
  135.     {
  136.     _cursescmode(oldmode);
  137.     hasold = FALSE;
  138.     }
  139.   } /* curson */
  140.